/*
  ID: nemokin1
  PROG: sort3
  LANG: C++
*/

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
 
using namespace std;
 
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define FORD(i,a,b) for(int i=(a);i>=b;--i)
#define FOREACH(it,c) for(typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define ALL(c) (c).begin(),(c).end()
 
#define debug(x) cerr<< #x << " = " << (x) << "\n";
#define debugv(v) cerr << #v << " = "; FOREACH(it,v) cerr << *it <<","; cerr << "\n";
#define SIZE(a)  (int(a.size()))
 
template<typename T> inline void checkMax(T& a, T b) {if (b>a) a=b;}
template<typename T> inline void checkMin(T& a, T b) {if (b<a) a=b;}
 
typedef long long LL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef long double ld;
const int INF = 1000000000;


int main() {
    freopen("sort3.in","r",stdin);freopen("sort3.out","w",stdout);
    vector<int> v;
    int N;
    cin >> N;
    REP(i,N){
	int d;
	cin >> d;
	v.push_back(d);
    }
    int a1=0,a2=0,a3=0;
    for(int i = 0; i < N; i++){
	if(v[i] == 1) a1++;
	if(v[i] == 2) a2++;
	if(v[i] == 3) a3++;
    }
    int a[3][3];
    memset(a,0,sizeof(a));
    
    for(int j = 0; j < a1; j++)
	a[0][v[j]-1]++;
    for(int j = 0; j < a2; j++)
	a[1][v[j+a1]-1]++;
    for(int j = 0; j < a3; j++)
	a[2][v[j+a1+a2]-1]++;
    //debug(min(a[0][1],a[1][0]));
    int tt = min(a[0][1],a[1][0]) + min(a[1][2],a[2][1]) + min(a[0][2],a[2][0]);
    int qt = abs(a[0][1]-a[1][0])*2;
    cout << tt+qt <<endl;
    
    exit(0);
}
